package cn.com.onlinetool.jt809.gsafety;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;

/**
 * @author xiaodonghong
 * @description TODO
 * @date 2023/6/13-10:30
 */
public class TxtDemo {
    public static void main(String[] args) throws IOException {
        String paths ="D:\\gsafety\\适岗状态课题\\课题5\\营运车船驾驶人员适岗状态网联智能监测预警平台-0611";
        List<String> ids = Files.readAllLines(Paths.get("D:\\gsafety\\适岗状态课题\\代码\\适岗状态课题5服务端\\src\\test\\java\\com\\gsafety\\fitness4dutystatus\\江苏省重点营运车辆动态监管平台.txt"));
        int i =1;
        String lev1 = "";
        String lev2 = "";
        String lev3 = "";
        String lev4 = "";
        for (String temp: ids){
            Path path =  Paths.get(paths);
            if (temp.startsWith("\t\t\t\t")){
                lev4 = temp.replaceAll("\\t","");
                String tempPath = paths+"\\"+lev1+"\\"+lev2+"\\"+lev3+"\\"+lev4;
                path =  Paths.get(tempPath);
                Files.createDirectories(path);
            }else if (temp.startsWith("\t\t\t")){
                lev3 =  temp.replaceAll("\\t","");
                String tempPath = paths+"\\"+lev1+"\\"+lev2+"\\"+lev3;
                path =  Paths.get(tempPath);
                Files.createDirectories(path);
            }else if (temp.startsWith("\t\t")){
                lev2 = temp.replaceAll("\\t","");
                String tempPath = paths+"\\"+lev1+"\\"+lev2;
                path =  Paths.get(tempPath);
                Files.createDirectories(path);
            }else if (temp.startsWith("\t")){
                lev1 = i+"."+temp.replaceAll("\\t","");
                String tempPath = paths+"\\"+lev1;
                i++;
                path =  Paths.get(tempPath);
                Files.createDirectories(path);
            }
        }
    }
}
